import request from '@/utils/request'
import qs from 'qs'

// 查看流程进度流程图
export function readProcessImg(id){
  return request({
    url:'/workflow/carPackageAudit/processImg/'+id,
    method:'get'
  })
}


//历史审批
export function historyProcess(instanceId){
  return request({
    url:'/workflow/carPackageAudit/history/'+instanceId,
    method: 'get'
  })
}

// 查询我的待办任务
export function listCarPackageAudit(query) {
  return request({
    url: '/workflow/task/todo',
    method: 'get',
    params: query
  })
}


//审批
export function approvalTask(data){
  let formatData = qs.stringify(data);
  return request({
    url:'/workflow/task/audit',
    headers:{"Content-Type":"application/x-www-form-urlencoded"},
    method: 'post',
    data: formatData
  })
}

/** 修改审批套餐表单数据回显 */
export function getServiceItem(id) {
  return request({
    url: '/workflow/serviceItem/' + id,
    method: 'get'
  })
}

/** 提交修改审批套餐的表单 */
export function updateForm(data){
  let formatData = qs.stringify(data);
  return request({
    url:'/workflow/task/update',
    headers:{"Content-Type":"application/x-www-form-urlencoded"},
    method: 'put',
    data: formatData
  })
}

/** 重新发起申请 */
export function reApplyPackageAudit(data){
  return request({
    url: '/workflow/task/reApply',
    method:'post',
    data
  })
}